cout<<hex 什么意思?

来源:百度知道 编辑:UC知道 时间:2024/05/15 18:16:19
整数输出的例子

int b=123456;对b赋初值
(1) cout<<b;输出: 123456
(2) cout<<hex<<b; 输出: 1e240
(3) cout<<setiosflags(ios∷uppercase)<<b;输出: 1E240
(4) cout<<setw(10)<<b<<′,′<<b; 输出: 123456,123456
(5) cout<<setfill(′*′)<<setw(10)<<b;输出: **** 123456
(6) cout<<setiosflags(ios∷showpos)<<b;输出: +123456

6种都什么意思 ?输出双精度数 我还懂点 这6个完全不懂额。。。

hex是以16进制输出数据
setw(n)用法: 通俗地讲就是预设宽度
setfill(char c) 用法 : 就是在预设宽度中如果已存在没用完的宽度大小,则用设置的字符c填充

看看这个吧http://user.qzone.qq.com/286378322/infocenter?ptlang=2052

16进制格式输出?